package com.jf.identity.controller;

import com.jf.identity.entity.BehaviorFeedBack;
import com.jf.identity.entity.ExamBaseParam;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.BehaviorService;
import com.jf.identity.util.Params;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by x on 2018/4/12.
 */
@Controller
@RequestMapping("/cdm/")
public class BehaviorController {
    @Resource
    private BehaviorService behaviorService;

    @RequestMapping(value = "get-examiner-behavior-info")
    @ResponseBody
    public ResponseBean getExaminerBehaviorInfo(@RequestBody ExamBaseParam examBaseParam) {

        return new ResponseBean(behaviorService.getBehaviorDetails(examBaseParam));
    }

    @RequestMapping(value = "set-examiner-behavior-status")
    @ResponseBody
    public ResponseBean setExaminerBehaviorStatus(@Validated @RequestBody BehaviorFeedBack behaviorFeedBack,
                                                  BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(behaviorService.insertExaminerBehaviorStatus(behaviorFeedBack));
    }

}
